<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>字典目录管理</title>
    <#include "/common/link.ftl">

</head>
<body class="hold-transition skin-black sidebar-mini">
<div class="wrapper">
    <#include "/common/navbar.ftl">

    <#assign currentMenu="systemDictionary"/>

    <#include "/common/menu.ftl">
    <div class="content-wrapper">
        <section class="content-header">
            <h1>字典目录管理</h1>
        </section>
        <section class="content">
            <div class="box">
                <!--高级查询--->
                <form class="form-inline" id="searchForm" action="/systemDictionary/list" method="post">
                    <input type="hidden" name="currentPage" id="currentPage" value="1">
                    <a href="#" class="btn btn-success btn-input" style="margin: 10px">
                        <span class="glyphicon glyphicon-plus"></span> 添加
                    </a>
                </form>
                <!--编写内容-->
                <div class="box-body table-responsive">
                    <table class="table table-hover table-bordered table-striped">
                        <thead>
                            <tr>
                                <th>编号</th>
                                <th>字典目录标题</th>
                                <th>字典目录编码</th>
                                <th>字典目录简介</th>
                                <th>操作</th>
                            </tr>
                        </thead>
                        <tbody>
                            <#list pageInfo.list as sd>
                                <tr>
                                    <td>${sd.id}</td>
                                    <td>${sd.title}</td>
                                    <td>${sd.sn}</td>
                                    <td>${sd.intro}</td>
                                    <td>
                                        <a href="#" class="btn btn-info btn-xs btn-input" data-json='${sd}'>
                                            <span class="glyphicon glyphicon-pencil"></span> 编辑
                                        </a>
                                    </td>
                                </tr>
                            </#list>
                        </tbody>
                    </table>
                    <#include "/common/page.ftl" >
                </div>
            </div>
        </section>
    </div>
    <#include "/common/footer.ftl" >
</div>
<div id="editForm" class="modal fade" tabindex="-1" role="dialog">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <form class="form-horizontal" action="/systemDictionary/saveOrUpdate" method="post">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title">新增/编辑</h4>
                </div>
                <div class="modal-body">
                    <input type="hidden" name="id">
                    <div class="form-group">
                        <label for="inputEmail3" class="col-sm-2 control-label">字典标题</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" name="title" placeholder="请输入数据字典标题">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputPassword3" class="col-sm-2 control-label">字典编号</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" name="sn"  placeholder="请输入数据字典编号">
                        </div>
                    </div>
                    <div class="form-group">
                        <label for="inputPassword3" class="col-sm-2 control-label">字典简介</label>
                        <div class="col-sm-10">
                            <input type="text" class="form-control" name="intro"  placeholder="请输入数据字典简介">
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
                    <button type="submit" class="btn btn-primary">保存</button>
                </div>
            </form>
        </div><!-- /.modal-content -->
    </div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script>
    $(".btn-input").click(function(){
        //console.log($(".btn-input"));//$(".btn-input")获取到的是集合, $(".btn-input").data("json")获取到集合第一个元素的data-json内容
        var data = $(this).data("json");
        $("#editForm input").val("");
        if(data){
            $("input[name=id]").val(data.id);
            $("input[name=title]").val(data.title);
            $("input[name=sn]").val(data.sn);
            $("input[name=intro]").val(data.intro);
        }
        $("#editForm").modal("show");
    });
</script>
</body>
</html>
